package com.learn.thread.demo01;

/**
 * 基于Thread类的线程创建和运行。
 * @author Java丶小明
 * @date 2021/6/25 14:19
 */
public class ThreadDemo extends Thread {
    private int number;

    public ThreadDemo(int number){
        super();
        this.number = number;
    }

    @Override
    public void run() {
        for (int i = 1; i < 10; i++) {
            System.out.printf("%s: %d * %d = %d\n",
                    Thread.currentThread().getName(), number, i, i * number);
        }
    }

    public static void main(String[] args) {
        for (int i = 1; i < 10; i++) {
            ThreadDemo threadDemo = new ThreadDemo(i);
            threadDemo.start();
        }
    }
}
